﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace randomLinQ
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Random r = new Random();
            int[] list = new int[100];
            for(int i = 0; i < 100; i++) {list[i]= r.Next(1000); }
            var ordered = from m in list orderby m descending select m;
            int sum = 0;
            foreach(int i in ordered) { Console.WriteLine(i);sum += i; }
            Console.WriteLine("SUM is " + sum);
            Console.WriteLine("AVG is " + ((double)sum / 100));
            Console.ReadKey();
            
        }
    }
}
